/*
 * @Description: 
 * @Date: 2022-02-18 09:44:44
 * @Author: caikaixuan
 * @LastEditTime: 2022-02-18 14:59:56
 */

const HelpService = require("../../services/HelpService");

async function HelpMessage(ctx,next){
    if (ctx.request.headers["x-wx-source"]) {
        const openid = ctx.request.headers["x-wx-openid"];
        let user = await HelpService.findUserByOpenid(openid)
        if (!user){
            user = await HelpService.createUser(openid)
        }
        ctx.rest(user)
    }
}

module.exports = {
    'POST /api/sendMessage':HelpMessage
};